cmake_minimum_required(VERSION 3.22)   
project(createtable)  


set(SRC_LISTS ${SRC_LISTS} ${CMAKE_CURRENT_SOURCE_DIR}/createtable.cpp) 
set(SRC_LISTS ${SRC_LISTS} ${CMAKE_CURRENT_SOURCE_DIR}/../public/db/mysql/_mysql.cpp)

set(SRC_LISTS1 ${SRC_LISTS1} ${CMAKE_CURRENT_SOURCE_DIR}/inserttables.cpp) 
set(SRC_LISTS1 ${SRC_LISTS1} ${CMAKE_CURRENT_SOURCE_DIR}/../public/db/mysql/_mysql.cpp)

set(SRC_LISTS2 ${SRC_LISTS2} ${CMAKE_CURRENT_SOURCE_DIR}/updatatables.cpp) 
set(SRC_LISTS2 ${SRC_LISTS2} ${CMAKE_CURRENT_SOURCE_DIR}/../public/db/mysql/_mysql.cpp)


set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/output) 
add_executable(createtable ${SRC_LISTS})
add_executable(inserttables ${SRC_LISTS1})
add_executable(updatatables ${SRC_LISTS2})


#增加头文件，库文件
target_include_directories(createtable PUBLIC  ${CMAKE_CURRENT_SOURCE_DIR}/../public/db/mysql)
target_include_directories(createtable PUBLIC  ${CMAKE_CURRENT_SOURCE_DIR}/../mysqllib/include)
target_include_directories(inserttables PUBLIC  ${CMAKE_CURRENT_SOURCE_DIR}/../public/db/mysql)
target_include_directories(inserttables PUBLIC  ${CMAKE_CURRENT_SOURCE_DIR}/../mysqllib/include)

target_include_directories(updatatables PUBLIC  ${CMAKE_CURRENT_SOURCE_DIR}/../public/db/mysql)
target_include_directories(updatatables PUBLIC  ${CMAKE_CURRENT_SOURCE_DIR}/../mysqllib/include)

target_link_directories(createtable PUBLIC  ${CMAKE_CURRENT_SOURCE_DIR}/../mysqllib/lib)
target_link_libraries(createtable PUBLIC mysqlclient)
target_link_directories(inserttables PUBLIC  ${CMAKE_CURRENT_SOURCE_DIR}/../mysqllib/lib)
target_link_libraries(inserttables PUBLIC mysqlclient)

target_link_directories(updatatables PUBLIC  ${CMAKE_CURRENT_SOURCE_DIR}/../mysqllib/lib)
target_link_libraries(updatatables PUBLIC mysqlclient)

# 显式指定编译器
set(CMAKE_CXX_COMPILER "g++")                                                                   #设置编译器


# 开启调试信息
set(CMAKE_BUILD_TYPE "Debug")
set(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -O0 -Wall -g2 -ggdb")
set(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} -O3 -Wall")

# 开启所有警告
set(CMAKE_CXX_FLAGS "-Wall")